package com.google.code.flabbyraffle;

import java.util.ArrayList;
import java.util.List;

import static java.util.Arrays.asList;

public class WinningNumbers extends ArrayList<Integer> {
    private static final String WHITE_SPACE = "\\s";

    public WinningNumbers(String winningString) {
        String[] numbers = winningString.trim().split(WHITE_SPACE);
        this.add(Integer.parseInt(numbers[0]));
        this.add(Integer.parseInt(numbers[1]));
        this.add(Integer.parseInt(numbers[2]));
    }

    public Integer containsNumber(Integer number) {
        Integer numberFound = 0;
        for (Integer winningNumber : this) {
            if (number == winningNumber) {
                numberFound++;
            }
        }
        return numberFound;
    }
}
